package com.rybbaby.tss.platform.sysPreserve.service.imp;

import java.sql.SQLException;
import java.util.List;

import com.rybbaby.tss.core.bean.TableBean;
import com.rybbaby.tss.core.bean.TableColumnBean;
import com.rybbaby.tss.core.web.service.imp.BaseServiceImp;
import com.rybbaby.tss.platform.sysPreserve.dao.IDatabasePreserveDao;
import com.rybbaby.tss.platform.sysPreserve.pojo.ExecSqlResult;
import com.rybbaby.tss.platform.sysPreserve.service.IDatabasePreserveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 谢进伟
 * @description
 * @createDate 2017/2/28 14:02
 */
@Service
@Transactional
public class DatabasePreserveService extends BaseServiceImp<Object> implements IDatabasePreserveService {
	
	@Autowired
	private IDatabasePreserveDao dao;
	
	@Transactional
	public List<TableBean> getAllTables() {
		return dao.getAllTables();
	}
	
	@Override
	public List<TableColumnBean> getTableColumns(String catalog , String tableName) throws ClassNotFoundException , SQLException , InstantiationException , IllegalAccessException {
		return dao.getTableColumns(catalog , tableName);
	}
	
	/**
	 * 执行sql
	 * 
	 * @param sqls
	 *            sql语句，多个sql语句用;隔开
	 * @return
	 */
	public List<ExecSqlResult> executeSql(String sqls) {
		return dao.executeSql(sqls);
	}
}
